inspector: ensure controller is a GtkGesture
authorChristian Hergert <chergert@redhat.com>
Sun, 20 Nov 2016 23:40:10 +0000 (15:40 -0800)
committerChristian Hergert <chergert@redhat.com>
Wed, 23 Nov 2016 22:03:13 +0000 (14:03 -0800)
While GtkEventController implementations today are all GtkGesture, it is
possible to create a GtkEventController manually. This is an extrac check
to ensure we only add gestures to the list.

https://bugzilla.gnome.org/show_bug.cgi?id=774760

gtk/inspector/gestures.c

index e448d5fd7920533da9be01cca3b55b3f4d6221ed..925a444aa53a4e2b349947296e6c3106de878273 100644 (file)
@@ -195,7 +195,12 @@ gtk_inspector_gestures_set_object (GtkInspectorGestures *sl,
     {
       list = _gtk_widget_list_controllers (GTK_WIDGET (object), phase);
       for (l = list; l; l = l->next)
-        g_hash_table_insert (hash, l->data, GINT_TO_POINTER (phase));
+        {
+          GtkEventController *controller = l->data;
+
+          if (GTK_IS_GESTURE (controller))
+            g_hash_table_insert (hash, controller, GINT_TO_POINTER (phase));
+        }
       g_list_free (list);
     }